package cn.fantasy.test;

/**
 * @author ET
 * @description 单例模式
 * @date 2021/6/21 14:24
 * @Version V1.0
 */
public class Singleton {

    private volatile static Singleton uniqueInstance;

    public static Singleton getUniqueInstance() {
        if (null == uniqueInstance) {
            synchronized (Singleton.class) {
                if (null == uniqueInstance) {
                    uniqueInstance = new Singleton();
                }
            }
        }
        return uniqueInstance;
    }
}
